home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / highlight / highlight-W32GUI-2.2-10b-Setup.exe / {app} / src / configurationreader.h < prev    next >
C/C++ Source or Header  |  2004-06-29  |  2KB  |  73 lines

  1. /***************************************************************************
  2.                           configurationreader.h  -  description
  3.                              -------------------
  4.     begin                : Son Nov 10 2002
  5.     copyright            : (C) 2002 by Andr∩┐╜Simon
  6.     email                : andre.simon1@gmx.de
  7.  ***************************************************************************/
  8.  
  9. /***************************************************************************
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  ***************************************************************************/
  17.  
  18. #ifndef CONFIGURATIONREADER_H
  19. #define CONFIGURATIONREADER_H
  20.  
  21. #include <string>
  22. #include <sstream>
  23. #include <map>
  24. #include <iostream>
  25. #include <fstream>
  26. #include <vector>
  27.  
  28. #include "stringtools.h"
  29.  
  30. using namespace std;
  31.  
  32. /** Maps parameter keys to values*/
  33. typedef map<string, string> ParameterMap;
  34.  
  35.  
  36. /** \brief Class to handle ASCII config files
  37.  
  38.   Configuration file format:<br>
  39.   $ParamName=ParamValue<br>
  40.   ParamValue may be splittet over multiple lines<br>
  41.   ParamName is not case sensitive<br>
  42.   Comments start with # as the first character of a line
  43.  
  44.  **/
  45.  
  46. class ConfigurationReader
  47.   {
  48.   public:
  49.     /** Constructor
  50.         \param configuration_path Path to configuration file 
  51.     */
  52.     ConfigurationReader(const string & configuration_path);
  53.     ~ConfigurationReader();
  54.     
  55.     /** \param paramName Name of parameter 
  56.         \return Value of parameter */
  57.     string &getParameter(const string & paramName);
  58.     const char* getCParameter(const string & paramName);
  59.  
  60.     /** \return True if config file exists */
  61.     bool found();
  62.     
  63.     /** \return List of parameter names */
  64.     vector<string> &getParameterNames();
  65.  
  66.   private:
  67.     ParameterMap parameterMap;
  68.     bool fileFound;    
  69.     vector<string> parameterNames;
  70.   };
  71.  
  72. #endif
  73.